package com.orhon.smartcampus.modules.systemctl.mm;


import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.systemctl.entity.Modules;
import com.orhon.smartcampus.modules.systemctl.gqlModel.GQLModule;

@Mapper(
        uses = {
                LangMapper.class,
                DictionaryMapper.class
        }
)
public interface ModuleMapper {

    ModuleMapper MAPPER = Mappers.getMapper(ModuleMapper.class);

    @Mapping(source ="id" , target = "id")
    @Mapping(source = "moduleName" , target = "module_name")
    @Mapping(source = "category" , target = "category", qualifiedByName = "str2dic")
    @Mapping(source = "moduleOrder" , target = "module_order")
    @Mapping(source = "mark" , target = "mark")
    @Mapping(source = "icon" , target = "icon")
    @Mapping(source = "clients" , target = "clients", qualifiedByName = "StringToList")
    @Mapping(source = "status" , target = "status")
    @Mapping(source = "meta" , target = "meta")
    @Mapping(source = "createdAt" , target = "created_at")
    @Mapping(source = "updatedAt" , target = "updated_at")
    @Mapping(source = "deletedAt" , target = "deleted_at")
    @Mapping(target = "menus" , ignore = true)
    @Mapping(target = "widgets" , ignore = true)
    @Mapping(target = "schools" , ignore = true)
    @Mapping(target = "oprations" , ignore = true)
    @Mapping(target = "home_id" , source = "home_id")
    GQLModule mapModule(Modules moduleentity);

    @InheritConfiguration(name = "mapModule")
    List<GQLModule> mapModuleList(List<Modules> entities);


}
